package assignmentImplementation;

import java.util.List;

import javax.annotation.Resource;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import keyValueBaseInterfaces.Predicate;


@Resource
public class LongerThanFivePred extends Predicate<ValueListImpl> {
	
	//The predicate checks that all values found in the valuelist are string with the length
	//greater than 5.
	
	public boolean evaluate(ValueListImpl input)
	{	
		int aux = 0;
		List<ValueImpl> list = input.toList();
		
		for(int i=0 ; i< list.size(); i++)
		{
			//This can be change , depending on what condition do we want the predicate to test.
			if(list.get(i).getValue().length() <= 5)
			{
				aux = 1;
			}
		}
		
		if(aux == 0) return true;
		else return false;
	}

}
